# @configure_input@
GO = go

BINARY = amf_http_server
PACKAGE = @PACKAGE@
prefix = @prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
sysconfdir = @sysconfdir@

.PHONY: all install clean

all: $(BINARY)

$(BINARY): main.go
	$(GO) build -o $@ -ldflags "-X main.sysConfigPath=${sysconfdir} -X main.packageName=${PACKAGE}" $^

distdir: $(BINARY)
	mkdir -p $(top_builddir)/http_server
	cp $(BINARY) $(top_builddir)/http_server

clean:
	$(RM) $(top_builddir)/http_server/$(BINARY)
	$(RM) $(BINARY)

install: $(BINARY) distdir
	mkdir -p $(prefix)/http_server 
	cp $(top_builddir)/http_server/$(BINARY) $(prefix)/http_server/

maintainer-clean:
	$(RM) $(top_builddir)/http_server/$(BINARY)
	$(RM) $(BINARY)